<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@ page import="com.hospital.util.*" %>
<%@ page import="java.util.*" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title></title>
<link href="images/main.css" rel="stylesheet" type="text/css" />
<link  href="../css/style.css" rel="stylesheet" type="text/css" />
<script type="text/javascript" src="../js/trim.js"></script>
<script language="javascript" type="text/javascript" src="../My97DatePicker/WdatePicker.js"></script>
<script type="text/javascript">
	function sub(){
		var ypjj = document.getElementById("ypjj");
		var ypsl = document.getElementById("ypsl");
		var jhrq = document.getElementById("jhrq");
		var ypcd = document.getElementById("ypcd");
		var yxq = document.getElementById("yxq");
		var dqrq = document.getElementById("dqrq");
		if(trim(ypjj.value).length == 0){
			alert("药物进价不能为空。");
			ypjj.focus();
		} else if(trim(ypsl.value).length == 0){
			alert("药物进货数量不能为空。");
			ypsl.focus();
		} else if(trim(jhrq.value).length == 0){
			alert("药物进货日期不能为空。");
			jhrq.focus();
		} else if(trim(ypcd.value).length == 0){
			alert("药物产地不能为空。");
			ypcd.focus();
		} else if(trim(yxq.value).length == 0){
			alert("药物有效期不能为空。");
			ysq.focus();
		} else if(trim(dqrq.value).length == 0){
			alert("药物到期日期不能为空。");
			dqrq.focus();
		} else{
			document.forms["form"].submit();
		}
	}
</script>
</head>
<body onload="init();">
	<jsp:include page="right_top.jsp"></jsp:include>
	<!-- TOP START -->
	<div id="right_font">
		<img src="images/main_14.gif" /> 您现在所在的位置：首页 → 药物进货管理 → <span
			class="bfont">添加进货单</span>
	</div>
	<!-- TOP END -->
	<hr >
	<form action="MedicineInAndOut?method=addjinhuo" method="post" name="form" id="form">
		<table style="margin-top: 30px;">
			<tr height="30px;">
				<td><font color="#FF0000">*</font>药物编码：</td>
				<td>
				<select name="ypmc" id="ypmc">
					<% 
						//添加进入t_medicinename中的Id号码
						String sql = "select * from t_medicinename";
						List<Map<String, Object>> list = DbUtil.find(sql);
						Map<String, Object> map = null;
						for (int i = 0; i < list.size(); i++) {
							map = (Map<String, Object>)list.get(i);
							if(!"无".equals(map.get("mname"))){
					%>
						<option value="<%=map.get("id")%>"><%=map.get("mname") %></option>
					<% 
							}
						}
					%>
				</select>
				</td>
				<td>&nbsp;</td>
			</tr>
			<tr height="30px;">
				<td><font color="#FF0000">*</font>进货库房：</td>
				<td>
				<select name="yplb" id="yplb">
					<% 
						//添加进入t_drugstorage_name中的库房名称
						String sqlkufang = "select * from t_drugstorage_name";
						List<Map<String, Object>> listkufang = DbUtil.find(sqlkufang);
						Map<String, Object> mapkufang = null;
						for (int i = 0; i < listkufang.size(); i++) {
							mapkufang = (Map<String, Object>)listkufang.get(i);
							if("正常".equals(mapkufang.get("state"))){
					%>
						<option value="<%=mapkufang.get("flmc")%>"><%=mapkufang.get("flmc") %></option>
					<%
						}
					 %>
					<% 
						}
					%>
				</select>
				</td>
				<td>&nbsp;</td>
			</tr>
			<tr height="30px;">
				<td><font color="#FF0000">*</font>药品剂型：</td>
				<td>
				<select name="ypjx" id="ypjx">
					<% 
						//添加进入t_ypmodel_set中的剂型名称
						String sqljixing = "select * from t_ypmodel_set";
						List<Map<String, Object>> listjixing = DbUtil.find(sqljixing);
						Map<String, Object> mapjixing = null;
						for (int i = 0; i < listjixing.size(); i++) {
							mapjixing = (Map<String, Object>)listjixing.get(i);
					%>
						<option value="<%=mapjixing.get("ypjx")%>"><%=mapjixing.get("ypjx") %></option>
					<% 
						}
					%>
				</select>
				</td>
				<td>&nbsp;</td>
			</tr>
			<tr height="30px;">
				<td><font color="#FF0000">*</font>药品单位：</td>
				<td>
				<select name="ypdw" id="ypdw">
					<% 
						//添加进入t_medicinename中的Id号码
						String sqldw = "select * from t_meterage_set";
						List<Map<String, Object>> listdw = DbUtil.find(sqldw);
						Map<String, Object> mapdw = null;
						for (int i = 0; i < listdw.size(); i++) {
							mapdw = (Map<String, Object>)listdw.get(i);
					%>
						<option value="<%=mapdw.get("dwmc")%>"><%=mapdw.get("dwmc") %></option>
					<% 
						}
					%>
				</select>
				</td>
				<td>&nbsp;</td>
			</tr>
			<tr height="30px;">
				<td><font color="#FF0000">*</font>药品进价：</td>
				<td><input type="text" name="ypjj" id="ypjj" maxlength="12" /></td>
				<td>&nbsp;</td>
			</tr>
			<tr height="30px;">
				<td><font color="#FF0000">*</font>药品数量：</td>
				<td><input type="text" name="ypsl" id="ypsl" maxlength="12" /></td>
				<td>&nbsp;</td>
			</tr>
			<tr height="30px;">
				<td><font color="#FF0000">*</font>进货日期：</td>
				<td><input id="jhrq" name="jhrq" type="text" onClick="WdatePicker()"/></td>
				<td>&nbsp;</td>
			</tr>
			<tr height="30px;">
				<td><font color="#FF0000">*</font>药品批号：</td>
				<td><input type="hidden" name="ypph" id="ypph" maxlength="12" />根据进货时间自动生成</td>
				<td>&nbsp;</td>
			</tr>
			<tr height="30px;">
				<td><font color="#FF0000">*</font>药品产地：</td>
				<td><input type="text" name="ypcd" id="ypcd" maxlength="12" /></td>
				<td>&nbsp;</td>
			</tr>
			<tr height="30px;">
				<td><font color="#FF0000">*</font>药品有效期：</td>
				<td><input type="text" name="yxq" id="yxq" maxlength="12" />月</td>
				<td>&nbsp;</td>
			</tr>
			<tr height="30px;">
				<td><font color="#FF0000">*</font>到期日期：</td>
				<td><input id="dqrq" name="dqrq" type="text" onClick="WdatePicker()"/></td>
				<td>&nbsp;</td>
			</tr>
			<tr height="30px;">
				<td colspan="2" align="center">
					<input type="button" value="提交" onclick="sub();"/>&nbsp;&nbsp;
					<input type="button" value="返回" onclick="history.go(-1);" />
				</td>
				<td>&nbsp;</td>
			</tr>
		</table>
	</form>
</body>
</html>